package day16.晚间练习.组播;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressDemo {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress address = InetAddress.getByName("192.168.23.127");
        String hostName = address.getHostName();//得到此ip地址的主机名字

        String hostAddress = address.getHostAddress();//返回文本显示中的IP地址字符串
        System.out.println("ip地址"+hostAddress);
        System.out.println("主机名"+hostName);

    }
}
